Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5467 Return useful error message for DDI upload. #7107

Merged
merged 1 commit into from
Jul 29, 2020
Merged

5467 Return useful error message for DDI upload. #7107

merged 1 commit into from
Jul 29, 2020

Conversation

JingMa87
Copy link
Contributor

@JingMa87 JingMa87 commented Jul 22, 2020

What this PR does / why we need it: Makes the error message more useful when uploading an invalid DDI XML

Which issue(s) this PR closes: 5467

Closes #5467

Special notes for your reviewer: In Dataverses.java I removed the exception from the method signature and handled it in a try catch, where I return a useful message. In ImportDDIServiceBean I added a try catch with a specific error message for the <codebook> element. In ImportServiceBean I removed the message "XMLStreamException" which isn't useful.

Suggestions on how to test this: Upload a pdf or invalid DDI XML and you will see a useful error message. If you upload a valid DDI XML starting from the <codebook> element, you will get a success message. If you upload a DDI XML where you remove the slashes from the identifier in the elements, you will get the invalid DOI error (make sure to do it for all occurrences of the identifier). I added the command and screenshots below. The success message is just to verify all is still working.

COMMAND

curl -H X-Dataverse-key:xxxxxxxxxxxx -X POST http://localhost:8080/api/dataverses/root/datasets/:importddi --upload-file test.xml

SUCCESS
image

FAIL
image

BAD DOI
image

Does this PR introduce a user interface change? If mockups are available, please link/include them here: No

Is there a release notes update needed for this change?: It's not a big change so no

Additional documentation:

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.0008%) to 19.609% when pulling 017cfb2 on JingMa87:5467-improve-ddi-error-message into 941d17d on IQSS:develop.

IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from Code Review 🦁 to QA 🔎✅ Jul 22, 2020
Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test this but the code change makes sense and I think it's a nice improvement.

@kcondon kcondon self-assigned this Jul 28, 2020
@kcondon kcondon merged commit df9ee29 into IQSS:develop Jul 29, 2020
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from QA 🔎✅ to Done 🚀 Jul 29, 2020
@JingMa87 JingMa87 deleted the 5467-improve-ddi-error-message branch July 29, 2020 18:50
@djbrooke djbrooke added this to the Dataverse 5 milestone Jul 29, 2020
@JingMa87
Copy link
Contributor Author

JingMa87 commented Jul 30, 2020

@TaniaSchlatter You can find the messages in the screenshots in the description.

@TaniaSchlatter
Copy link
Member

@JingMa87 Right - API only. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

As a depositor, I want to know why the API to create datasets using DDI xml failed
6 participants